<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>21日 (_key_盒子模型 css选择器) | 学习笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="xylim">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-expandable-chapters-interactive/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-sectionx/sectionx.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../2018/September/25.html" />
    
    
    <link rel="prev" href="../../2018/September/20.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="1.4"
        data-chapter-title="21日 (_key_盒子模型 css选择器)"
        data-filepath="2018/September/21.md"
        data-basepath="../.."
        data-revision="Wed Oct 10 2018 10:28:01 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="2018/September/九月份September.html">
            
                
                    <a href="../../2018/September/九月份September.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        九月份 September
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="2018/September/18.html">
            
                
                    <a href="../../2018/September/18.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        18日 (_key_html标签入门介绍)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="2018/September/19.html">
            
                
                    <a href="../../2018/September/19.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        19日 (_key_git提交 markdown语法)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="2018/September/20.html">
            
                
                    <a href="../../2018/September/20.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        20日 (_key_多媒体 ifram)
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="1.4" data-path="2018/September/21.html">
            
                
                    <a href="../../2018/September/21.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        21日 (_key_盒子模型 css选择器)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="2018/September/25.html">
            
                
                    <a href="../../2018/September/25.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        25日 (_key_字体 icon 边框画圆、三角 伪元素选择器 行高 垂直对齐)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="2018/September/26.html">
            
                
                    <a href="../../2018/September/26.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        26日 (_key_浮动 文本处理 行内块空隙处理)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="2018/September/27.html">
            
                
                    <a href="../../2018/September/27.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        27日 (_key_定位 渐变色)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="2018/September/30.html">
            
                
                    <a href="../../2018/September/30.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        30日 (_key_过渡transition 转换transform 开关demo)
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="2018/October/十月份October.html">
            
            <span><b>2.</b> 十月份 October</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="2018/October/8.html">
            
                
                    <a href="../../2018/October/8.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        8日 (_key_动画 sass)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="2018/October/9.html">
            
                
                    <a href="../../2018/October/9.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        9日 (_key_滤镜 git版本回退)
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="2018/October/10.html">
            
                
                    <a href="../../2018/October/10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        10日 (_key_XXX)
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >学习笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <html><head></head><body><h1 id="21&#x65E5;">21&#x65E5;</h1>
<p><br></p>
<h4 id="&#x91CD;&#x70B9;&#x77E5;&#x8BC6;">&#x91CD;&#x70B9;&#x77E5;&#x8BC6;</h4>
<h6 id="&#x76F8;&#x5173;&#x77E5;&#x8BC6;&#xFF1A;&#x76D2;&#x5B50;&#x6A21;&#x578B;-&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x5668;-&#x4F2A;&#x7C7B;&#x9009;&#x62E9;&#x5668;-&#x5173;&#x7CFB;&#x9009;&#x62E9;&#x5668;">&#x76F8;&#x5173;&#x77E5;&#x8BC6;&#xFF1A;&#x76D2;&#x5B50;&#x6A21;&#x578B; &#x5C5E;&#x6027;&#x9009;&#x62E9;&#x5668; &#x4F2A;&#x7C7B;&#x9009;&#x62E9;&#x5668; &#x5173;&#x7CFB;&#x9009;&#x62E9;&#x5668;</h6>
<p><br></p>
<ul>
<li>&#x6682;&#x65F6;&#x6CA1;&#x6709; <a href="25.html">&#x4E0B;&#x4E00;&#x7BC7;</a></li>
</ul>
<sec data-title="&#x76D2;&#x5B50;&#x6A21;&#x578B;" data-id="section0" data-show="true"><div class="panel panel-default"><div class="panel-heading"><h2>&#x76D2;&#x5B50;&#x6A21;&#x578B;<a class="pull-right section atTitle btn btn-default" target="section0"><span class="fa fa-angle-up"></span></a></h2></div><div class="panel-collapse in" id="section0"><div class="panel-body">
<pre><code>
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset=&quot;UTF-8&quot;&gt;
        &lt;title&gt;&lt;/title&gt;
        &lt;style type=&quot;text/css&quot;&gt;

            div{
                box-sizing: border-box;
                width: 200px;
                padding: 20px;
                border: 2px solid red ;
            }


            /*
             * &#x6807;&#x51C6;&#x76D2;&#x5B50;&#x6A21;&#x578B;&#x6240;&#x5360;&#x9762;&#x79EF;&#xFF1A;width+padding+border  &#xFF08;border&#x589E;&#x52A0;  &#x603B;&#x5BBD;&#x5EA6;&#x589E;&#x52A0;&#xFF09;
             * IE&#x76D2;&#x5B50;&#xFF08;&#x602A;&#x5F02;&#x6A21;&#x5F0F;&#xFF09; &#x9762;&#x79EF;&#xFF1A;width              &#xFF08;  border&#x589E;&#x52A0; &#x603B;&#x5BBD;&#x5EA6;&#x4E0D;&#x53D8; &#x5185;&#x5BB9;&#x5BBD;&#x5EA6;&#x7F29;&#x5C0F;&#xFF09;
             *
             * 
             *  &#x6807;&#x51C6;&#x76D2;&#x5B50;&#xFF1A;box-sizing:content-box;
             *  IE&#x76D2;&#x5B50;   : box-sizing:border-box;
             * 
             *     margin padding border
             *         
             *         &#x4E00;&#x4E2A;&#x503C;     &#xFF1A;4&#x4E2A;&#x65B9;&#x5411;&#x90FD;&#x7528;&#x540C;&#x4E00;&#x4E2A;&#x503C;
             *         &#x4E24;&#x4E2A;&#x503C;    &#xFF1A;&#x5206;&#x522B;&#x4EE3;&#x8868;&#x4E0A;&#x4E0B;&#x548C;&#x5DE6;&#x53F3;&#xFF08;&#x987A;&#x65F6;&#x9488;&#xFF09;
             *         &#x56DB;&#x4E2A;&#x503C;    &#xFF1A;&#x4E0A; &#x3001;&#x53F3; &#x3001;&#x4E0B;&#x3001;&#x5DE6;&#xFF08;&#x987A;&#x65F6;&#x9488;&#xFF09;
             *         
             *         
             *     
             * 
             */


        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;

        &lt;div id=&quot;&quot;&gt;
            ...
        &lt;/div&gt;

    &lt;/body&gt;
&lt;/html&gt;
</code></pre></div></div></div></sec>
<sec data-title="&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x5668;" data-id="section1" data-show="true"><div class="panel panel-default"><div class="panel-heading"><h2>&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x5668;<a class="pull-right section atTitle btn btn-default" target="section1"><span class="fa fa-angle-up"></span></a></h2></div><div class="panel-collapse in" id="section1"><div class="panel-body">
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset=&quot;UTF-8&quot;&gt;
        &lt;title&gt;
            &#x5C5E;&#x6027;&#x9009;&#x62E9;&#x5668;
        &lt;/title&gt;

        &lt;style type=&quot;text/css&quot;&gt;

            input{
                width: 200px;

            }
            /*&#x5C5E;&#x6027;&#x9009;&#x62E9;&#x5668;  Element[att = &quot;value&quot;]
                        &#x6807;&#x7B7E;&#x5BF9;&#x8C61;[&#x5C5E;&#x6027;&#x540D;=&quot;&#x503C;&quot;]     

            */
            input[type=&quot;haha&quot;]{
                border-color: red;
            }
            /*&#x8868;&#x793A;&#x53EA;&#x8981;&#x5305;&#x542B;&#x8BE5;&#x5C5E;&#x6027;&#x5C31;&#x9009;&#x4E2D;*/
            input[name]{
                border-color: blue;
            }

            /*&#x8868;&#x793A;&#x5339;&#x914D; &#x5C5E;&#x6027;&#x7684;&#x503C;&#x4EE5;&#x7A7A;&#x683C;&#x9694;&#x5F00;&#x7684;&#x7247;&#x6BB5;*/
            input[my~=&quot;hello&quot;]{
                border-color: green;
            }


            /*&#x8868;&#x793A;&#x5339;&#x914D;&#x4EE5;XX&#x4E3A;&#x5F00;&#x5934;&#x7684;&#x503C;*/
            input[data^=&quot;ab&quot;]
            {
                background-color: yellow;
            }

            /*&#x8868;&#x793A;&#x5339;&#x914D;&#x4EE5;XX&#x4E3A;&#x7ED3;&#x5C3E;&#x7684;&#x503C;*/
            input[data$=&quot;ef&quot;]
            {
                border-color: red;
            }

            /*&#x8868;&#x793A;&#x5339;&#x914D;&#x5305;&#x542B;XXX&#x7684;&#x503C;*/
            input[data*=&quot;e&quot;]
            {
                border-color: blue;
            }

            /*&#x8868;&#x793A;&#x4EE5;XXX&#x4E3A;&#x5F00;&#x5934;&#x7684;&#x5E76;&#x4E14;&#x4EE5;-&#x4E3A;&#x8FDE;&#x63A5;&#x989D;&#x503C;*/
            input[data|=&quot;abc&quot;]
            {
                height: 100px;
            }

        &lt;/style&gt;

    &lt;/head&gt;
    &lt;body&gt;
        &lt;input type=&quot;haha&quot;  /&gt;
        &lt;input type=&quot;password&quot; name /&gt;


        &lt;input type=&quot;text&quot; my=&quot;hello world&quot; /&gt;
        &lt;input type=&quot;text&quot;  data=&quot;abc-def&quot; /&gt;


    &lt;/body&gt;
&lt;/html&gt;
</code></pre></div></div></div></sec>
<sec data-title="&#x4F2A;&#x7C7B;&#x9009;&#x62E9;&#x5668;" data-id="section2" data-show="true"><div class="panel panel-default"><div class="panel-heading"><h2>&#x4F2A;&#x7C7B;&#x9009;&#x62E9;&#x5668;<a class="pull-right section atTitle btn btn-default" target="section2"><span class="fa fa-angle-up"></span></a></h2></div><div class="panel-collapse in" id="section2"><div class="panel-body">
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset=&quot;UTF-8&quot;&gt;
        &lt;title&gt;&#x4F2A;&#x7C7B;&#x9009;&#x62E9;&#x5668;&lt;/title&gt;
        &lt;style type=&quot;text/css&quot;&gt;

            /*link         &#x9ED8;&#x8BA4;&#x672A;&#x8BBF;&#x95EE;&#x7684;&#x72B6;&#x6001;
              visited     &#x5DF2;&#x8BBF;&#x95EE;
              hover:     &#x9F20;&#x6807;&#x60AC;&#x505C;
              active:     &#x8868;&#x793A;&#x70B9;&#x51FB;&#x65F6;&#x7684;&#x6FC0;&#x6D3B;&#x72B6;&#x6001;
            */

            a:link{
                color: gray;
            }
            a:visited{
                color: blue;
            }

            a:hover{
                color: red;
                font-size: 100px;
            }

            a:active{
                color: yellow;
            }

            /*&#x805A;&#x7126;&#x72B6;&#x6001;*/
            input:focus{
                /*&#x63CF;&#x8FB9;*/
                outline-color: red;

            }

            /*&#x9009;&#x4E2D;&#x72B6;&#x6001;*/
            /*&#x65B0; &#x5C0F;&#x77E5;&#x8BC6;&#x70B9;&#xFF01;&#xFF01;&#xFF01;*/
            input:checked+label{
                color:red;
            }

            ul li:first-child{
                color: red;
            }

            ul li:last-child{
                color: green;
            }

            ul li:nth-child(2){
                color: blue;
            }

            ul li:nth-last-child(2){
                color: skyblue;
            }


            /*&#x65B0;&#x77E5;&#x8BC6;&#x70B9;  2&#x7684;&#x500D;&#x6570;&#x4E2A; &#xFF08;&#x5076;&#x6570;&#x9879;&#xFF09;*/
            ul li:nth-child(2n){
                color: blue;
            }

            /*&#x65B0;&#x77E5;&#x8BC6;&#x70B9;  &#x5947;&#x6570;&#x9879;*/
            ul li:nth-child(2n-1){
                color: red;
            }

            /*&#x65B0;&#x77E5;&#x8BC6;&#x70B9; &#x9664;&#x4E86;&#x67D0;&#x4E2A;&#x5143;&#x7D20;&#x4E0D;&#x53D8;&#x5176;&#x4ED6;&#x90FD;&#x6539;&#x53D8; */
            ul li:not(:nth-child(3)){
                color: blue;
            }


            /*
                 &#x4F2A;&#x7C7B;&#x4E2D;&#x7684;child&#x7CFB;&#x5217;
                 nth&#x91CC;&#x9762;&#x7684;&#x62EC;&#x53F7;&#x8981;&#x4F20;&#x5165;&#x4ECE;1&#x5F00;&#x59CB;&#x7684;&#x503C; &#x53EF;&#x4EE5;&#x7ED3;&#x5408;&#x672A;&#x77E5;&#x6570;n&#x6765;&#x4F7F;&#x7528;

             */



            ol li:first-of-type{
                color: red;
            }

            ol li:last-of-type{
                color: red;
            }

            ol li:nth-of-type(2){
                color: red;
            }

            /*&#x552F;&#x4E00;&#x7684;&#x4E00;&#x4E2A;&#x513F;&#x5B50;*/
            ol div:only-of-type{
                color: orange;
            }

            /*    clear:  &#x7B2C;n&#x4E2A;&#x513F;&#x5B50;&#x548C;&#x540C;&#x6837;&#x7684;&#x7C7B;&#x578B;&#x624D;&#x80FD;&#x5339;&#x914D;
                 type:     &#x540C;&#x7C7B;&#x578B;&#x7684;&#x7B2C;n&#x4E2A;
            */



        &lt;/style&gt;

    &lt;/head&gt;
    &lt;body&gt;

        &lt;!--  &#x7C7B;class  --&gt;

        &lt;!-- &#x4F2A;&#x7C7B;&#xFF1A;
            1.&#x4EA4;&#x4E92;&#x7684;&#x6548;&#x679C;
            2.&#x9009;&#x62E9;&#x7B2C;N&#x4E2A;&#x5143;&#x7D20;

        --&gt;

        &lt;a href=&quot;#&quot;&gt; &#x70B9;&#x6211;&#x6709;&#x60CA;&#x559C; &lt;/a&gt;

        &lt;input type=&quot;text&quot; /&gt;

        &lt;input type=&quot;checkbox&quot; name=&quot;&quot; id=&quot;ch&quot; value=&quot;&quot; /&gt;
        &lt;label for=&quot;ch&quot;&gt;&#x9009;&#x4E2D;&lt;/label&gt;

        &lt;ul&gt;
            &lt;li&gt;li01&lt;/li&gt;
            &lt;li&gt;li02&lt;/li&gt;
            &lt;li&gt;li03&lt;/li&gt;
            &lt;li&gt;li04&lt;/li&gt;
            &lt;li&gt;li05&lt;/li&gt;
        &lt;/ul&gt;


        &lt;ol&gt;
            &lt;li&gt;li01&lt;/li&gt;
            &lt;div&gt;li02&lt;/div&gt;
            &lt;li&gt;li03&lt;/li&gt;
            &lt;li&gt;li04&lt;/li&gt;
            &lt;li&gt;li05&lt;/li&gt;
        &lt;/ol&gt;

    &lt;/body&gt;
&lt;/html&gt;
</code></pre></div></div></div></sec>
<sec data-title="&#x5173;&#x7CFB;&#x9009;&#x62E9;&#x5668;" data-id="section3" data-show="true"><div class="panel panel-default"><div class="panel-heading"><h2>&#x5173;&#x7CFB;&#x9009;&#x62E9;&#x5668;<a class="pull-right section atTitle btn btn-default" target="section3"><span class="fa fa-angle-up"></span></a></h2></div><div class="panel-collapse in" id="section3"><div class="panel-body">
<pre><code>
        &#x5173;&#x7CFB;&#x9009;&#x62E9;&#x5668;

            A B            &#x540E;&#x4EE3;&#x9009;&#x62E9;&#x5668;(A&#x4E0B;&#x9762;&#x7684;&#x6240;&#x6709;B)
            A&gt;B            &#x5B50;&#x4EE3;~(A&#x7684;B&#x5B50;&#x5143;&#x7D20;)
            A+B            &#x76F8;&#x90BB;~(A&#x540E;&#x7684;[&#x540C;&#x7EA7;]&#x4E00;&#x4E2A;B&#x5143;&#x7D20;)
            A~B            &#x5144;&#x5F1F;~(A&#x540E;&#x7684;[&#x540C;&#x7EA7;]&#x5168;&#x90E8;B&#x5143;&#x7D20;)
</code></pre></div></div></div></sec></body></html>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../2018/September/20.html" class="navigation navigation-prev " aria-label="Previous page: 20日 (_key_多媒体 ifram)"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../2018/September/25.html" class="navigation navigation-next " aria-label="Next page: 25日 (_key_字体 icon 边框画圆、三角 伪元素选择器 行高 垂直对齐)"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-expandable-chapters-interactive/expandable-chapters.js"></script>
    

    
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sectionx/sectionx.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"expandable-chapters-interactive":{},"sectionx":{},"splitter":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
